

class ReTally {
  int notifyId; //柜id
  int tallyTaskId; //任务id
  String containerNo; //柜号
  String lpn;
  String barcode;
  String sku;
  String location;
  int quantity;
  int ctnQty;
  int pcsQty;
  String upType = "CTN"; //上架方式
  int switchNotifyId; //转移的入仓Id
  List<InventoryListDTO> vos;

  ReTally({
    this.notifyId,
    this.tallyTaskId,
    this.containerNo,
    this.lpn,
    this.barcode,
    this.sku,
    this.location,
    this.quantity,
    this.ctnQty,
    this.pcsQty,
    this.upType,
    this.switchNotifyId,
    this.vos,
  });

  factory ReTally.fromJson(Map<String, dynamic> json) {
    return ReTally(
      notifyId: json["notifyId"] == null ? null : int.parse("${json["notifyId"]}"),
      tallyTaskId: json["tallyTaskId"],
      containerNo: json["containerNo"],
      lpn: json["lpn"],
      barcode: json["barcode"],
      sku: json["sku"],
      location: json["location"],
      quantity: json["quantity"],
      ctnQty: json["ctnQty"],
      pcsQty: json["pcsQty"],
      upType: json["upType"],
      switchNotifyId: json["switchNotifyId"],
      vos: json['vos'] == null ? null : (new List<dynamic>.from(json['vos']).map((userJson) => InventoryListDTO.fromJson(userJson)).toList()),
    );
  }
//

}

class Adjust {
  int type;
  String text;
  String barcode;
  String inventory;
  List<InventoryListDTO> inventory_list;
  String location;

  Adjust({
    this.type,
    this.text,
    this.barcode,
    this.inventory,
    this.inventory_list,
    this.location,
  });

  factory Adjust.fromJson(Map<String, dynamic> json) {
    return Adjust(
      type: json["type"],
      text: json["text"],
      barcode: json["barcode"],
      inventory: json["inventory"],
      inventory_list: json['inventory_list'] == null ? null : (new List<dynamic>.from(json['inventory_list']).map((userJson) => InventoryListDTO.fromJson(userJson)).toList()),
      location: json["location"],
    );
  }
//

}

class ReTallyQr {
  String lpn; //lpn
  int notifyId; //入仓预报id
  int tallyTaskId; //任务id
  String sku; //sku
  String location; //location
  int ctnQty; //调整数量
  int pcsQty; //调整数量
  int reTallyQty; //调整数量
  int switchNotifyId; //转移的入仓Id
  LpnPhotoReqVo lpnPhotoReqVo = new LpnPhotoReqVo();

  Map<String, dynamic> toJson() {
    return {
      "lpn": this.lpn,
      "notifyId": this.notifyId,
      "tallyTaskId": this.tallyTaskId,
      "sku": this.sku,
      "location": this.location,
      "ctnQty": this.ctnQty,
      "pcsQty": this.pcsQty,
      "reTallyQty": this.reTallyQty,
      "switchNotifyId": this.switchNotifyId,
      "lpnPhotoReqVo": this.lpnPhotoReqVo,
    };
  }
}

class LpnPhotoReqVo {
  String photo1;
  String photo2;
  String photo3;
  String photo4;

  Map<String, dynamic> toJson() {
    return {
      "photo1": this.photo1,
      "photo2": this.photo2,
      "photo3": this.photo3,
      "photo4": this.photo4,
    };
  }
}

class Measure {
  int notifyId; //柜id
  int tallyTaskId; //柜任务ID
  double length; //长
  double width; //宽
  double height; //高
  double weight; //重量
  String sku;
  String lpn;
  String location;
  String measure; //length,width,height
  String measureLength;
  String measureLength2;
  String measureWidth;
  String measureWidth2;
  String measureHeight;
  String measureHeight2;
  String measureWeight;
  String measureWeight2;

  List<String> locations = new List();
  List<String> lengthPaths = new List();
  List<String> widthPaths = new List();
  List<String> heightPaths = new List();
  List<String> weightPaths = new List();

  Measure({
    this.notifyId,
    this.tallyTaskId,
    this.length,
    this.width,
    this.height,
    this.weight,
    this.sku,
    this.lpn,
    this.location,
    this.measure,
    this.measureLength,
    this.measureLength2,
    this.measureWidth,
    this.measureWidth2,
    this.measureHeight,
    this.measureHeight2,
    this.measureWeight,
    this.measureWeight2,
    this.locations,
    this.lengthPaths,
    this.widthPaths,
    this.heightPaths,
    this.weightPaths,
  });

  factory Measure.fromJson(Map<String, dynamic> json) {
    return Measure(
      notifyId: json["notifyId"],
      tallyTaskId: json["tallyTaskId"],
      length: json["length"],
      width: json["width"],
      height: json["height"],
      weight: json["weight"],
      sku: json["sku"],
      lpn: json["lpn"],
      location: json["location"],
      measure: json["measure"],
      measureLength: json["measureLength"],
      measureLength2: json["measureLength2"],
      measureWidth: json["measureWidth"],
      measureWidth2: json["measureWidth2"],
      measureHeight: json["measureHeight"],
      measureHeight2: json["measureHeight2"],
      measureWeight: json["measureWeight"],
      measureWeight2: json["measureWeight2"],
      locations: json['locations'] == null ? null : new List<String>.from(json['locations']) as List<String>,
      lengthPaths: json['lengthPaths'] == null ? null : new List<String>.from(json['lengthPaths']) as List<String>,
      widthPaths: json['widthPaths'] == null ? null : new List<String>.from(json['widthPaths']) as List<String>,
      heightPaths: json['heightPaths'] == null ? null : new List<String>.from(json['heightPaths']) as List<String>,
      weightPaths: json['weightPaths'] == null ? null : new List<String>.from(json['weightPaths']) as List<String>,
    );
  }

  Map<String, dynamic> toJson() {
    return {
      "notifyId": this.notifyId,
      "tallyTaskId": this.tallyTaskId,
      "length": this.length,
      "width": this.width,
      "height": this.height,
      "weight": this.weight,
      "sku": this.sku,
      "lpn": this.lpn,
      "location": this.location,
      "measure": this.measure,
      "measureLength": this.measureLength,
      "measureLength2": this.measureLength2,
      "measureWidth": this.measureWidth,
      "measureWidth2": this.measureWidth2,
      "measureHeight": this.measureHeight,
      "measureHeight2": this.measureHeight2,
      "measureWeight": this.measureWeight,
      "measureWeight2": this.measureWeight2,
      "locations": this.locations,
      "lengthPaths": this.lengthPaths,
      "widthPaths": this.widthPaths,
      "heightPaths": this.heightPaths,
      "weightPaths": this.weightPaths,
    };
  }
}

class CycleCountSku {
  int taskId;
  String sku;
  int total;
  int lpnQty;
  bool isCycleCountFinish;
  InventoryListDTO inventory; //是否盘点完成
  List<InventoryListDTO> inventoryList;
  String location;

  String barcode;

  CycleCountSku({
    this.taskId,
    this.sku,
    this.total,
    this.lpnQty,
    this.isCycleCountFinish,
    this.inventory,
    this.inventoryList,
    this.location,
  });

  factory CycleCountSku.fromJson(Map<String, dynamic> json) {
    return CycleCountSku(
      taskId: json["taskId"],
      sku: json["sku"],
      total: json["total"],
      lpnQty: json["lpnQty"],
      isCycleCountFinish: json["isCycleCountFinish"],
      inventory: json["inventory"] == null ? null : InventoryListDTO.fromJson(json["inventory"]),
      inventoryList: json['inventoryList'] == null ? null : (new List<dynamic>.from(json['inventoryList']).map((userJson) => InventoryListDTO.fromJson(userJson)).toList()),
      location: json["location"],
    );
  }
}

class InventoryListDTO {
  String sku; //sku
  int quantity; //数量
  String lpn; //lpn
  String wholeCode; //库位
  int locationId;
  bool isCheck; //是否盘点
  List<String> barcodes = new List();
  int inboundLockedQty; //库存锁定数量
  int isNewReturn; //是否新退件 1:新退件 0:老退件

  InventoryListDTO({
    this.sku,
    this.quantity,
    this.lpn,
    this.wholeCode,
    this.locationId,
    this.isCheck,
    this.barcodes,
    this.inboundLockedQty,
    this.isNewReturn,
  });

  factory InventoryListDTO.fromJson(Map<String, dynamic> json) {
    return InventoryListDTO(
      sku: json["sku"],
      quantity: json["quantity"],
      lpn: json["lpn"],
      wholeCode: json["wholeCode"],
      locationId: json["locationId"],
      isCheck: json["isCheck"],
      barcodes: json['barcodes'] == null ? null : new List<String>.from(json['barcodes']) as List<String>,
      inboundLockedQty: json["inboundLockedQty"],
      isNewReturn: json["isNewReturn"],
    );
  }
}

class CCSkuTrk {
  String lpn;
  String sku;
  String location;
  int taskId;
  int inventoryType;
  List<ReturnCycleListDTO> returnCycleList;
  String reason;

  CCSkuTrk({
    this.lpn,
    this.sku,
    this.location,
    this.taskId,
    this.inventoryType,
    this.returnCycleList,
    this.reason,
  });

  factory CCSkuTrk.fromJson(Map<String, dynamic> json) {
    return CCSkuTrk(
      lpn: json["lpn"],
      sku: json["sku"],
      location: json["location"],
      taskId: json["taskId"],
      inventoryType: json["inventoryType"],
      returnCycleList: json['returnCycleList'] == null ? null : (new List<dynamic>.from(json['returnCycleList']).map((userJson) => ReturnCycleListDTO.fromJson(userJson)).toList()),
      reason: json["reason"],
    );
  }

  Map<String, dynamic> toJson() {
    return {
      "lpn": this.lpn,
      "sku": this.sku,
      "location": this.location,
      "taskId": this.taskId,
      "inventoryType": this.inventoryType,
      "returnCycleList": this.returnCycleList,
      "reason": this.reason,
    };
  }
}

class ReturnCycleListDTO {
  String trackingCode;
  String sku;
  String shortTrackingCode; //短码

  ReturnCycleListDTO({
    this.trackingCode,
    this.sku,
    this.shortTrackingCode,
  });

  factory ReturnCycleListDTO.fromJson(Map<String, dynamic> json) {
    return ReturnCycleListDTO(
      trackingCode: json["trackingCode"],
      sku: json["sku"],
      shortTrackingCode: json["shortTrackingCode"],
    );
  }

  Map<String, dynamic> toJson() {
    return {
      "trackingCode": this.trackingCode,
      "sku": this.sku,
      "shortTrackingCode": this.shortTrackingCode,
    };
  }
}

class CycleCountSkuQr {
  String sku;
  String lpn;
  String trackingCode;

  Map<String, dynamic> toJson() {
    return {
      "sku": this.sku,
      "lpn": this.lpn,
      "trackingCode": this.trackingCode,
    };
  }
}

class CycleCountBean {
  bool lpnIsCheck; //lpn是否盘点
  List<InventoryListDTO> latest_inventory = new List(); //已盘点库存
  List<InventoryListDTO> pending_inventory = new List(); //待盘点库存

  int isNewReturn; //是否新退件 1是 0否
  int isTips; //是否提示 1是 0否 （选择yes时 isNewReturn要改为1）

  String location;
  String lpn;

  CycleCountBean({
    this.lpnIsCheck,
    this.latest_inventory,
    this.pending_inventory,
    this.isNewReturn,
    this.isTips,
  });

  factory CycleCountBean.fromJson(Map<String, dynamic> json) {
    return CycleCountBean(
      lpnIsCheck: json["lpnIsCheck"],
      latest_inventory: json['latest_inventory'] == null ? null : (new List<dynamic>.from(json['latest_inventory']).map((userJson) => InventoryListDTO.fromJson(userJson)).toList()),
      pending_inventory: json['pending_inventory'] == null ? null : (new List<dynamic>.from(json['pending_inventory']).map((userJson) => InventoryListDTO.fromJson(userJson)).toList()),
      isNewReturn: json["isNewReturn"],
      isTips: json["isTips"],
    );
  }

}

class CycleCountLocationQr{
  String location; //库位号
  String lpn;//lpn
  List<SkuListDTO> skuAndQty;

  Map<String, dynamic> toJson() {
    return {
      "location": this.location,
      "lpn": this.lpn,
      "skuAndQty": this.skuAndQty,
    };
  }
}
 class SkuListDTO {
  String sku;
  int quantity;

  Map<String, dynamic> toJson() {
    return {
      "sku": this.sku,
      "quantity": this.quantity,
    };
  }
}

class CycleCountLocationLpnQr {
  String lpn;
  String trackingCode;

  CycleCountLocationLpnQr({
    this.lpn,
    this.trackingCode,
  });
}
